package com.example.study.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.util.ResourceUtils;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 功能描述：
 *
 * @Author: liqiancheng
 * @Email: liqiancheng@centfor.com
 * @Date: 2020/6/4 17:25
 **/
@Configuration
public class MyWebConfig implements WebMvcConfigurer{

    /**
    * 功能描述：增加静态资源的映射
    * @Param: registry
    * @Author: liqiancheng
    * @date: 2020/6/4
    * @return:
    **/
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/img/**").addResourceLocations( ResourceUtils.CLASSPATH_URL_PREFIX + "/static/img/");
        System.out.println(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/img/");
    }
}
